package frame;

import java.awt.Color;
import java.awt.Container;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

import pnlBeheer.PnlCatBeheer;
import pnlBeheer.PnlGDBeheer;
import pnlBeheer.PnlMenuBeheer;
import pnlSwitch.RBPanelSwitcher;
import pnlSwitch.PnlSystemController;


public class FrameResBeheer extends JFrame{

	/**
	 * 
	 */
	private static final long serialVersionUID = 586704363730644450L;

	private Container window = getContentPane();
	
	private JPanel pnlmain;
	private JButton btnMB;
	private JButton btnCat;
	private JButton btnGDB;
	private JButton btnBack;
	private PnlGDBeheer pnlGD;
	private PnlMenuBeheer pnlM;
	private PnlCatBeheer pnlC;


	private ImageIcon imgHome;
	private PnlSystemController cpsys;
	private RBPanelSwitcher cps;
	
	
	public FrameResBeheer(){
		
		this.cps = new RBPanelSwitcher(this);
		this.cpsys = new PnlSystemController(this);
		
		initGUI();
		}
		
		public void initGUI(){
		
			setTitle("MainFrame with a Panel");
			setExtendedState(MAXIMIZED_BOTH);
			setUndecorated(true);
			setLayout(null);

			pnlmain = new JPanel();
			pnlmain.setBackground(Color.pink);
			pnlmain.setBounds(0,0,1367,87);
			pnlmain.setVisible(true);
			pnlmain.setLayout(null);
			add(pnlmain);
			
	    	imgHome = new ImageIcon(getClass().getResource("/image/home.gif"));
	    	btnBack = new JButton(imgHome);
	    	btnBack.setBounds(1100, 2, 70, 85);
	    	btnBack.addActionListener(cpsys);
	    	btnBack.setActionCommand("main");
	    	btnBack.setVisible(true);
	    	pnlmain.add(btnBack);
			
	    	btnMB = new JButton("Menu beheer");
	    	btnMB.setBounds(30,2,140,80);
	    	btnMB.addActionListener(cps);
	    	btnMB.setActionCommand("menu");
	    	btnMB.setVisible(true);
	    	pnlmain.add(btnMB);
	    	
	    	btnCat = new JButton("Categorie beheer");
	    	btnCat.setBounds(370,2,140,80);
	    	btnCat.addActionListener(cps);
	    	btnCat.setActionCommand("categorie");
	    	btnCat.setVisible(true);
	    	pnlmain.add(btnCat);
	    	
	    	btnGDB = new JButton();
	    	btnGDB.setText("Consumtie beheer");
	    	btnGDB.setBounds(200,2,140,80);
	    	btnGDB.addActionListener(cps);
	    	btnGDB.setActionCommand("consumtie");
	    	btnGDB.setVisible(true);
	    	pnlmain.add(btnGDB);	    	
	    	
        	pnlGD = new PnlGDBeheer();
        	pnlGD.setBounds(0, 87, 1367, 800);
        	pnlGD.setVisible(true);
        	window.add(pnlGD);
        	
        	pnlM = new PnlMenuBeheer();
        	pnlM.setBounds(0, 87, 1367, 800);
        	pnlM.setVisible(false);
        	window.add(pnlM);
        	
        	pnlC = new PnlCatBeheer();
        	pnlC.setBounds(0, 87, 1367, 800);
        	pnlC.setVisible(false);
        	window.add(pnlC);
        	
        	
        	pack();      
		}
	
		public PnlMenuBeheer getPnlM(){
			return pnlM;
		}
		public PnlGDBeheer getPnlGD(){
			return pnlGD;
		}
		public PnlCatBeheer getPnlC(){
			return pnlC;
		}
		
		public JButton getbtnMB(){
			return btnMB;
		}
		public JButton getbtnGDB(){
			return btnGDB;
		}
}
